package com.medical.admin.sys.mapper;

import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.medical.admin.sys.entity.Admin;
import com.medical.admin.sys.entity.Role;
import org.apache.ibatis.annotations.Param;

import java.util.List;


/*
 * @Date : 2024/4/26 16:36
 * @Created by Lang
 * @ProjectName : medical-appointment-registration
 */
    
public interface RoleMapper extends BaseMapper<Role> {

    default Integer updateRole(Role role){
        LambdaUpdateWrapper<Role> eq = new UpdateWrapper<Role>().lambda()
                .set(Role::getMarRoleName, role.getMarRoleName())
                .set(Role::getMarRoleDetail, role.getMarRoleDetail())
                .set(Role::getMarRoleStatus, role.getMarRoleStatus())
                .eq(Role::getMarRoleId, role.getMarRoleId());
        return this.update(eq);
    }

    default Integer delBatch(List<Integer> integers){
        LambdaUpdateWrapper<Role> in = new UpdateWrapper<Role>().lambda().set(Role::getMarRoleStatus, 0).in(Role::getMarRoleId, integers);
        return this.update(in);
    }
}